package com.ittable.datasource.route.biz;

import com.ittable.datasource.route.dao.single.DomainDAO;
import com.ittable.datasource.route.dao.single.PluginDAO;
import com.ittable.datasource.route.model.Domain;
import com.ittable.datasource.route.model.Plugin;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @author srh
 * @date 2020/12/20
 **/
@Service
public class DynamicTransactionalBiz {

    @Resource
    private PluginDAO pluginDAO;

    @Resource
    private DomainDAO domainDAO;

    @Transactional(rollbackFor = Exception.class)
    public void save(Plugin plugin, Domain domain) {
        int pluginCount = pluginDAO.save(plugin);

        int domainCount = domainDAO.insert(domain);

        throw new RuntimeException();
    }
}
